package p270jp.pxv.android.notification.presentation.activity;

import android.content.ComponentCallbacks;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.p024v4.media.C0261e;
import android.view.MenuItem;
import android.view.View;
import androidx.activity.ComponentActivity;
import androidx.compose.p026ui.platform.C0536v1;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.MaterialToolbar;
import p041ba.C1048a;
import p047bg.C1124a;
import p064c6.Preconditions;
import p108di.RecyclerViewEndlessScrollListener;
import p116e.ActionBarDrawerToggle;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p184gi.ScreenView;
import p189gn.AbstractC3435a;
import p211hi.FirebaseAnalyticsAction;
import p216hn.Lambda;
import p216hn.Reflection;
import p265jk.ListItemNotificationItemBinding;
import p265jk.ListItemNotificationItemNewBinding;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.Notification;
import p270jp.pxv.android.notification.presentation.flux.NotificationsActionCreator;
import p270jp.pxv.android.notification.presentation.flux.NotificationsStore;
import p310lc.C4621b;
import p314lg.ActivityNotificationsBinding;
import p325m0.MutabilityOwnership;
import p337mc.GroupieAdapter;
import p364nc.BindableItem;
import p372nk.AbstractActivityC5378d;
import p372nk.C5384n;
import p393of.C5453b;
import p393of.PixivDateTimeFormatter;
import p398ok.NotificationsDividerItemDecoration;
import p425pk.NotificationsState;
import p467rd.subscribers;
import p579vo.Qualifier;
import p603wm.AbstractC6949c;
import p625xi.LegacyNavigation;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p671zc.Disposable;
import p677zi.PixivImageLoader;

/* compiled from: NotificationsActivity.kt */
/* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity */
/* loaded from: classes2.dex */
public final class NotificationsActivity extends AbstractActivityC5378d {

    /* renamed from: p0 */
    public static final /* synthetic */ int f19190p0;

    /* renamed from: g0 */
    public NotificationsDividerItemDecoration f19196g0;

    /* renamed from: i0 */
    public RecyclerViewEndlessScrollListener f19198i0;

    /* renamed from: k0 */
    public PixivDateTimeFormatter f19200k0;

    /* renamed from: l0 */
    public NotificationsState f19201l0;

    /* renamed from: m0 */
    public ActionBarDrawerToggle f19202m0;

    /* renamed from: b0 */
    public final AbstractC6949c f19191b0 = Preconditions.m9802P(1, new C4287d(this, null, null));

    /* renamed from: c0 */
    public final AbstractC6949c f19192c0 = C4621b.m3851a(this, C4286c.f19212c);

    /* renamed from: d0 */
    public final AbstractC6949c f19193d0 = Preconditions.m9802P(1, new C4288e(this, null, null));

    /* renamed from: e0 */
    public final AbstractC6949c f19194e0 = Preconditions.m9802P(1, new C4289f(this, null, null));

    /* renamed from: f0 */
    public final GroupieAdapter f19195f0 = new GroupieAdapter();

    /* renamed from: h0 */
    public final LinearLayoutManager f19197h0 = new LinearLayoutManager(1, false);

    /* renamed from: j0 */
    public final CompositeDisposable f19199j0 = new CompositeDisposable();

    /* renamed from: n0 */
    public final AbstractC6949c f19203n0 = new ViewModelLazy(Reflection.m5499a(NotificationsActionCreator.class), new C4291h(this), new C4290g(this));

    /* renamed from: o0 */
    public final AbstractC6949c f19204o0 = new ViewModelLazy(Reflection.m5499a(NotificationsStore.class), new C4293j(this), new C4292i(this));

    /* compiled from: NotificationsActivity.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$a */
    /* loaded from: classes2.dex */
    public static final class C4284a extends BindableItem<ListItemNotificationItemNewBinding> {

        /* renamed from: d */
        public static final C4284a f19205d = new C4284a();

        public C4284a() {
            super(0);
        }

        @Override // p337mc.Item
        /* renamed from: b */
        public int mo3603b() {
            return R.layout.list_item_notification_item_new;
        }

        @Override // p364nc.BindableItem
        /* renamed from: e */
        public void mo3420e(ListItemNotificationItemNewBinding eVar, int i) {
            MutabilityOwnership.m3745m(eVar, "viewBinding");
        }

        @Override // p364nc.BindableItem
        /* renamed from: f */
        public ListItemNotificationItemNewBinding mo3419f(View view) {
            MutabilityOwnership.m3745m(view, "view");
            return ListItemNotificationItemNewBinding.m4876a(view);
        }
    }

    /* compiled from: NotificationsActivity.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$b */
    /* loaded from: classes2.dex */
    public static final class C4285b extends BindableItem<ListItemNotificationItemBinding> {

        /* renamed from: i */
        public static final /* synthetic */ int f19206i;

        /* renamed from: d */
        public final PixivImageLoader f19207d;

        /* renamed from: e */
        public final PixivDateTimeFormatter f19208e;

        /* renamed from: f */
        public final NotificationsActionCreator f19209f;

        /* renamed from: g */
        public final PixivAnalytics f19210g;

        /* renamed from: h */
        public final Notification f19211h;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4285b(PixivImageLoader aVar, PixivDateTimeFormatter cVar, NotificationsActionCreator notificationsActionCreator, PixivAnalytics eVar, Notification notification) {
            super(notification.getId());
            MutabilityOwnership.m3745m(aVar, "pixivImageLoader");
            MutabilityOwnership.m3745m(notificationsActionCreator, "actionCreator");
            MutabilityOwnership.m3745m(notification, "notification");
            this.f19207d = aVar;
            this.f19208e = cVar;
            this.f19209f = notificationsActionCreator;
            this.f19210g = eVar;
            this.f19211h = notification;
        }

        @Override // p337mc.Item
        /* renamed from: b */
        public int mo3603b() {
            return R.layout.list_item_notification_item;
        }

        /* JADX WARN: Removed duplicated region for block: B:19:0x0047  */
        /* JADX WARN: Removed duplicated region for block: B:20:0x0049  */
        /* JADX WARN: Removed duplicated region for block: B:29:0x005d  */
        /* JADX WARN: Removed duplicated region for block: B:30:0x0073  */
        /* JADX WARN: Removed duplicated region for block: B:40:0x00df  */
        /* JADX WARN: Removed duplicated region for block: B:41:0x00e1  */
        /* JADX WARN: Removed duplicated region for block: B:43:0x00e4  */
        /* JADX WARN: Removed duplicated region for block: B:44:0x00e6  */
        /* JADX WARN: Removed duplicated region for block: B:51:0x0105  */
        @Override // p364nc.BindableItem
        /* renamed from: e */
        /* Code decompiled incorrectly, please refer to instructions dump */
        public void mo3420e(p265jk.ListItemNotificationItemBinding r9, int r10) {
            /*
            // Method dump skipped, instructions count: 290
            */
            throw new UnsupportedOperationException("Method not decompiled: p270jp.pxv.android.notification.presentation.activity.NotificationsActivity.C4285b.mo3420e(c4.a, int):void");
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof C4285b)) {
                return false;
            }
            C4285b bVar = (C4285b) obj;
            return MutabilityOwnership.m3749h(this.f19207d, bVar.f19207d) && MutabilityOwnership.m3749h(this.f19208e, bVar.f19208e) && MutabilityOwnership.m3749h(this.f19209f, bVar.f19209f) && MutabilityOwnership.m3749h(this.f19210g, bVar.f19210g) && MutabilityOwnership.m3749h(this.f19211h, bVar.f19211h);
        }

        @Override // p364nc.BindableItem
        /* renamed from: f */
        public ListItemNotificationItemBinding mo3419f(View view) {
            MutabilityOwnership.m3745m(view, "view");
            return ListItemNotificationItemBinding.m4877a(view);
        }

        public int hashCode() {
            int hashCode = this.f19208e.hashCode();
            int hashCode2 = this.f19209f.hashCode();
            int hashCode3 = this.f19210g.hashCode();
            return this.f19211h.hashCode() + ((hashCode3 + ((hashCode2 + ((hashCode + (this.f19207d.hashCode() * 31)) * 31)) * 31)) * 31);
        }

        public String toString() {
            StringBuilder c = C0261e.m12042c("NotificationItem(pixivImageLoader=");
            c.append(this.f19207d);
            c.append(", pixivDateTimeFormatter=");
            c.append(this.f19208e);
            c.append(", actionCreator=");
            c.append(this.f19209f);
            c.append(", pixivAnalytics=");
            c.append(this.f19210g);
            c.append(", notification=");
            c.append(this.f19211h);
            c.append(')');
            return c.toString();
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$d */
    /* loaded from: classes2.dex */
    public static final class C4287d extends Lambda implements AbstractC3435a<PixivImageLoader> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19213a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4287d(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19213a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, zi.a] */
        @Override // p189gn.AbstractC3435a
        public final PixivImageLoader invoke() {
            return C1124a.m10173s(this.f19213a).f24118a.m920a().m621a(Reflection.m5499a(PixivImageLoader.class), null, null);
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$e */
    /* loaded from: classes2.dex */
    public static final class C4288e extends Lambda implements AbstractC3435a<LegacyNavigation> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19214a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4288e(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19214a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, xi.a] */
        @Override // p189gn.AbstractC3435a
        public final LegacyNavigation invoke() {
            return C1124a.m10173s(this.f19214a).f24118a.m920a().m621a(Reflection.m5499a(LegacyNavigation.class), null, null);
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$f */
    /* loaded from: classes2.dex */
    public static final class C4289f extends Lambda implements AbstractC3435a<PixivAnalytics> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19215a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4289f(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19215a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [ei.e, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final PixivAnalytics invoke() {
            return C1124a.m10173s(this.f19215a).f24118a.m920a().m621a(Reflection.m5499a(PixivAnalytics.class), null, null);
        }
    }

    /* compiled from: ActivityViewModelLazy.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$g */
    /* loaded from: classes2.dex */
    public static final class C4290g extends Lambda implements AbstractC3435a<ViewModelProvider.AbstractC0728b> {

        /* renamed from: a */
        public final /* synthetic */ ComponentActivity f19216a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4290g(ComponentActivity componentActivity) {
            super(0);
            this.f19216a = componentActivity;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelProvider.AbstractC0728b invoke() {
            ViewModelProvider.AbstractC0728b defaultViewModelProviderFactory = this.f19216a.getDefaultViewModelProviderFactory();
            MutabilityOwnership.m3746l(defaultViewModelProviderFactory, "defaultViewModelProviderFactory");
            return defaultViewModelProviderFactory;
        }
    }

    /* compiled from: ActivityViewModelLazy.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$h */
    /* loaded from: classes2.dex */
    public static final class C4291h extends Lambda implements AbstractC3435a<ViewModelStore> {

        /* renamed from: a */
        public final /* synthetic */ ComponentActivity f19217a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4291h(ComponentActivity componentActivity) {
            super(0);
            this.f19217a = componentActivity;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelStore invoke() {
            ViewModelStore viewModelStore = this.f19217a.getViewModelStore();
            MutabilityOwnership.m3746l(viewModelStore, "viewModelStore");
            return viewModelStore;
        }
    }

    /* compiled from: ActivityViewModelLazy.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$i */
    /* loaded from: classes2.dex */
    public static final class C4292i extends Lambda implements AbstractC3435a<ViewModelProvider.AbstractC0728b> {

        /* renamed from: a */
        public final /* synthetic */ ComponentActivity f19218a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4292i(ComponentActivity componentActivity) {
            super(0);
            this.f19218a = componentActivity;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelProvider.AbstractC0728b invoke() {
            ViewModelProvider.AbstractC0728b defaultViewModelProviderFactory = this.f19218a.getDefaultViewModelProviderFactory();
            MutabilityOwnership.m3746l(defaultViewModelProviderFactory, "defaultViewModelProviderFactory");
            return defaultViewModelProviderFactory;
        }
    }

    /* compiled from: ActivityViewModelLazy.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.NotificationsActivity$j */
    /* loaded from: classes2.dex */
    public static final class C4293j extends Lambda implements AbstractC3435a<ViewModelStore> {

        /* renamed from: a */
        public final /* synthetic */ ComponentActivity f19219a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4293j(ComponentActivity componentActivity) {
            super(0);
            this.f19219a = componentActivity;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelStore invoke() {
            ViewModelStore viewModelStore = this.f19219a.getViewModelStore();
            MutabilityOwnership.m3746l(viewModelStore, "viewModelStore");
            return viewModelStore;
        }
    }

    public NotificationsActivity() {
        super(R.layout.activity_notifications);
    }

    /* renamed from: e1 */
    public static final void m4577e1(NotificationsActivity notificationsActivity) {
        notificationsActivity.m4573i1().f21459d.setVisibility(8);
    }

    /* renamed from: f1 */
    public static final void m4576f1(NotificationsActivity notificationsActivity) {
        notificationsActivity.m4573i1().f21460e.m4598a();
    }

    /* renamed from: g1 */
    public static final void m4575g1(NotificationsActivity notificationsActivity) {
        notificationsActivity.m4573i1().f21457b.setVisibility(8);
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b
    /* renamed from: b1 */
    public void mo4578b1(boolean z) {
        Preconditions.m9795W(this, z);
    }

    /* renamed from: h1 */
    public final NotificationsActionCreator m4574h1() {
        return (NotificationsActionCreator) this.f19203n0.getValue();
    }

    /* renamed from: i1 */
    public final ActivityNotificationsBinding m4573i1() {
        return (ActivityNotificationsBinding) this.f19192c0.getValue();
    }

    /* renamed from: j1 */
    public final LegacyNavigation m4572j1() {
        return (LegacyNavigation) this.f19193d0.getValue();
    }

    /* renamed from: k1 */
    public final void m4571k1(String str, String str2) {
        m4573i1().f21459d.setVisibility(0);
        m4573i1().f21463h.setText(str);
        if (str2 == null || str2.length() == 0) {
            m4573i1().f21458c.setVisibility(8);
            return;
        }
        m4573i1().f21458c.setVisibility(0);
        m4573i1().f21458c.setText(str2);
    }

    @Override // p270jp.pxv.android.activity.BaseActivity, p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity, android.content.ComponentCallbacks
    public void onConfigurationChanged(Configuration configuration) {
        MutabilityOwnership.m3745m(configuration, "newConfig");
        super.onConfigurationChanged(configuration);
        ActionBarDrawerToggle bVar = this.f19202m0;
        if (bVar != null) {
            bVar.f12467d = bVar.f12464a.mo6985d();
            bVar.m7050i();
            return;
        }
        MutabilityOwnership.m3737u("drawerToggle");
        throw null;
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f19200k0 = new PixivDateTimeFormatter(this, C5453b.f24268a);
        MaterialToolbar materialToolbar = m4573i1().f21464i;
        MutabilityOwnership.m3746l(materialToolbar, "binding.toolBar");
        C0536v1.m11537h(this, materialToolbar, R.string.notifications);
        ActionBarDrawerToggle bVar = new ActionBarDrawerToggle(this, this.f18773J, R.string.app_name, R.string.app_name);
        this.f19202m0 = bVar;
        bVar.m7052g(true);
        DrawerLayout drawerLayout = this.f18773J;
        ActionBarDrawerToggle bVar2 = this.f19202m0;
        if (bVar2 != null) {
            drawerLayout.m11360a(bVar2);
            m4573i1().f21461f.setLayoutManager(this.f19197h0);
            m4573i1().f21461f.setAdapter(this.f19195f0);
            this.f19196g0 = new NotificationsDividerItemDecoration(this);
            RecyclerView recyclerView = m4573i1().f21461f;
            NotificationsDividerItemDecoration aVar = this.f19196g0;
            if (aVar != null) {
                recyclerView.m10871g(aVar);
                m4573i1().f21462g.setOnRefreshListener(new C1048a(this, 23));
                Disposable g = subscribers.m2589g(((NotificationsStore) this.f19204o0.getValue()).f19260e.m986o(AndroidSchedulers.m334a()), null, null, new p372nk.NotificationsActivity(this), 3);
                CompositeDisposable aVar2 = this.f19199j0;
                MutabilityOwnership.m3744n(aVar2, "compositeDisposable");
                aVar2.mo82c(g);
                Disposable g2 = subscribers.m2589g(((NotificationsStore) this.f19204o0.getValue()).f19261f.m986o(AndroidSchedulers.m334a()), null, null, new C5384n(this), 3);
                CompositeDisposable aVar3 = this.f19199j0;
                MutabilityOwnership.m3744n(aVar3, "compositeDisposable");
                aVar3.mo82c(g2);
                NotificationsActionCreator h1 = m4574h1();
                h1.f19250c.mo2437b(new FirebaseAnalyticsAction(new ScreenView(AnalyticsScreenName.PIXIV_NOTIFICATIONS, null, null, 6)));
                h1.m4564d();
                return;
            }
            MutabilityOwnership.m3737u("itemDecoration");
            throw null;
        }
        MutabilityOwnership.m3737u("drawerToggle");
        throw null;
    }

    @Override // p014ae.AdActivity, p270jp.pxv.android.activity.BaseActivity, p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        this.f19199j0.m80f();
        super.onDestroy();
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, androidx.activity.ComponentActivity, android.app.Activity
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        MutabilityOwnership.m3745m(menuItem, "item");
        ActionBarDrawerToggle bVar = this.f19202m0;
        if (bVar == null) {
            MutabilityOwnership.m3737u("drawerToggle");
            throw null;
        } else if (bVar.m7054e(menuItem)) {
            return true;
        } else {
            return super.onOptionsItemSelected(menuItem);
        }
    }

    @Override // p116e.ActivityC2727f, android.app.Activity
    public void onPostCreate(Bundle bundle) {
        super.onPostCreate(bundle);
        ActionBarDrawerToggle bVar = this.f19202m0;
        if (bVar != null) {
            bVar.m7050i();
        } else {
            MutabilityOwnership.m3737u("drawerToggle");
            throw null;
        }
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p014ae.AdActivity, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onResume() {
        super.onResume();
        if (MutabilityOwnership.m3749h(this.f19201l0, NotificationsState.C5644f.f24832a)) {
            m4574h1().m4564d();
        }
        if (this.f19201l0 instanceof NotificationsState.C5642d) {
            m4574h1().f19254g.f22596b.mo305g(Boolean.TRUE);
        }
    }
}
